from django import forms


class BootstrapForm(object):

    bootstarp_class_exclude = []

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        # 循环找到所有插件，添加属性
        for name, field in self.fields.items():
            if name in self.bootstarp_class_exclude:
                continue
            field.widget.attrs = {'class': 'form-control', 'placeholder': '请输入' + field.label, 'type': field.label}
